package cn.tedu.csmall.product.controller;

import cn.tedu.csmall.product.pojo.dto.CategoryAttributeTemplateAndNewDTO;
import cn.tedu.csmall.product.service.ICategoryAttributeTemplateService;
import cn.tedu.csmall.product.web.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Api(tags = "08.类别与属性模版的关联管理模块")
@RestController
@Slf4j
@RequestMapping("/attribute-template")
public class CategoryAttributeTemplateController {
    @Autowired
    ICategoryAttributeTemplateService service;
    public CategoryAttributeTemplateController() {
        log.info("创建配置类对象:CategoryAttributeTemplateController");
    }
    @ApiOperation("添加类别与属性模版的关联")
    @PostMapping("/add-new")
    public JsonResult<Void> and(CategoryAttributeTemplateAndNewDTO categoryAttributeTemplateAndNewDTO){
        log.debug("请求参数：{}",categoryAttributeTemplateAndNewDTO);
        service.andNew(categoryAttributeTemplateAndNewDTO);
        return JsonResult.ok();
    }
    @ApiOperation("根据id删除类别与属性模版的关联")
    @PostMapping("/{id:[0-9]+}/delete")
    public JsonResult<Void> delete(@PathVariable Long id){
        log.debug("请求参数：{}",id);
        service.delete(id);
        return JsonResult.ok();
    }
    @ApiOperation("根据查询类别与属性模版的关联")
    @PostMapping("")
    public JsonResult<Void> list(){


        return JsonResult.ok();
    }
}
